export function ListReducer(state = {
  id: 1,
  users: [
    {
      uid: 1, uname: '张3', uage: 22
    }
  ]
}, action) {
  switch (action.type) {
    case 'ADDUSER':
      {  // 如何去修改对象里面的数组
        let users = JSON.parse(JSON.stringify(state.users))
        users.push(action.payload)
        return { ...state, users };
      }
    case 'DELETEUSER':
      {
        let users = JSON.parse(JSON.stringify(state.users))
        users.pop(action.payload)
        return { ...state, users };
      }
    case 'UPDATEUSERS':
      {
        let users = action.payload
        return { ...state, users };
      }

    default:
      return state;
  }
}